// 导入 Joi 来定义验证规则
const Joi = require('joi')

const username = Joi.string().alphanum().min(1).max(10).required()
const password = Joi.string().pattern(/^[\S]{6,12}$/).required()

const nickname = Joi.string().required()
const email = Joi.string().email().required()

const avatar = Joi.string().dataUri().required()

exports.scheme = {
    body:{
        username,password
    }
}

exports.update_scheme = {
    body:{
        email,nickname
    }
}

exports.update_password_scheme = {
    body:{
        oldPwd:password,
        newPwd:Joi.not(Joi.ref('oldPwd')).concat(password)
    }
}

exports.update_avatar_scheme ={
    body:{
        avatar
    }
}
